<?php
if (!defined("IN_OP"))
{
    exit("You can't access this file directly...");
}
$subid = intval(getvar("subid"));
if ($subid == 0) $subid = 1;
else if ($subid < 1 || 6 < $subid)
{
    exit("error!!");
}
switch ($subid)
{
    case 1 :
        $rateTable = "rate41";
        break;
    case 2 :
        $rateTable = "rate42";
        break;
    case 3 :
        $rateTable = "rate43";
        break;
    case 4 :
        $rateTable = "rate44";
        break;
    case 5 :
        $rateTable = "rate45";
        break;
    case 6 :
        $rateTable = "rate46";
        break;
}
$ui = new UI(true,'',true);
$tpl = new Template_Member();
$tpl->load(array("main" => "6h/zmt.tpl", "menu" => "6h/6h_menu.tpl","header"=>"game_header.tpl","foot"=>"game_foot.tpl"));
$tpl->set($fp," class='select'");
$tpl->set('tblName','六合彩');
$tpl->show("menu");
$tpl->set("rtype_".$subid,"checked");
if ($curruser['enabled'] != 1)
{
    $ui->showErrorPage("<p class=error>帐号已被暂停使用</p>");
    exit();
}
$rs = getdb("select * from lotto where open>='" . date("Y-m-d") . "' order by open limit 1");
if ($rs->eof)
{
    $ui->showErrorPage("<div class='time'><div class='timeDiv2'>以官方公告为准</div></div>");
    exit();
}
$open = $rs->f['open'];
$round = $rs->f['round'];
$lotto_id = $rs->f['id'];
$stopbet = $conf->get("stopbet");
if (date("Y-m-d") < $open)
{
    $ui->showErrorPage("<div class='time'><div class='timeDiv2'>以官方公告为准</div></div>");
    exit();
}
else if (date("Y-m-d") == $open)
{
    if ($stopbet <= date("Hi"))
    {
        $ui->showErrorPage("<div class='time'><div class='timeDiv2'>以官方公告为准</div></div>");
        exit();
    }
    else if (date("Hi") <= $conf->get("startbet"))
    {
        $ui->showErrorPage("<p class=error>目前非下单时段</p><script>setTimeout('location.reload()',30000);</script>");
        exit();
    }
}
$tpl->set("cchinayear", intval($conf->get("chinayear")));
$t1 = strtotime($open . " " . $stopbet);
$tpl->Set("timestap", $t1 - systime());
$tpl->set("phptime", systime());
$tpl->set("open", $open);
$tpl->set("round", d3($round));
$tpl->set("lotto_id", $lotto_id);
$tpl->set("sid", $subid);
$tpl->set("betName","正码特".$subid);
$tpl->set("gametype",0);
$tpl->set("changetype",'<input type="button" class="btn btn-primary" style="height:25px; width:40px; color: #FFFFFF;" name="sub_a" value="勾选" id="sub_a" onclick="ChangeSelType(1)" >&nbsp;<input type="button" class="btn btn-primary" style="height:25px; width:40px; color: #FFFFFF;" name="sub_b" value="快选" id="sub_b" onclick="ChangeSelType(2)" >');


$select_disk = getUserValidDiskSelect($curruser, "RefRate()");
$tpl->set("select_disk", $select_disk);
$disk = $g_disk_code[getUserValidDisk($curruser)];
$rs = getdb("select lotto_id from {$rateTable}" . $disk . " where lotto_id={$lotto_id} limit 1");
if ($rs->eof)
{
    $ui->showErrorPage("<p class=error>系统目前维护中，请稍後！</p>");
    exit();
}
$rs->close();
$tpl->show("header");
$tpl->show("main");
$tpl->show("foot");
?>